home *** CD-ROM | disk | FTP | other *** search
- #include <stdlib.h>
- #include "textmenu.h"
-
- void TextMenu::calcItemsNumber()
- {
- int len = 0;
- for(count = 0; itemStrings[count][0] != '\0'; count++)
- {
- len = max(len, strlen(itemStrings[count]));
- }
- itemSize = loc(len, 1);
- itemDistance = loc(4, 4);
- }
- /////////////////////////
- void TextMenu::showItem()
- {
- rect where = getItemCoord();
- int left = where.origin.X + 1;
- int center = where.origin.Y + where.height() / 2;
- settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
- settextjustify(LEFT_TEXT, CENTER_TEXT);
- setcolor(pColorSet->colors.ATTR_COLOR);
- outtextxy(left, center, itemStrings[pos - 1]);
- }
- ///////////////////////////
- void TextMenu::setItems()
- {
- itemStrings = global + 1; // exclude global[0]
- pos = 1;
- calcConsts();
- }
- ///////////////////////////
- /*
- void main()
- {
- if(!init_KNOW_HOW())
- return;
- setfillstyle(SOLID_FILL, pColorSet->colors.BAK_COLOR);
- bar(0, 0, getmaxx(), getmaxy());
-
- char* LIST[] = { "1. one", "2. two", "3. three", "4. four",
- "5. five", "6. six", "7. seven", "8. eight",
- "9. nine", "" };
- TextMenu t(rect(10, 10, 60, 16), "window.pcy", "TEXT MENU",
- "123456789", 1, 1,
- LIST, rect(0, 24, 79, 25), STRING_STATUS,
- LIST, NULL, FIXED, 3, SHOW_BORDER, SHOW_BORDER, 20, 21);
- t.show_window();
- t.exe();
- t.hide();
- close_KNOW_HOW();
- closegraph();
- }
- */